<?php if($action == 'c'):?>
	<div class="forum-index">
		<?php $catName =  App::CategorySet()->categoryIdToName($id);?>
		<div class="forum-top-link">
			<a href="<?php echo $this->baseurl("/forum/"); ?>"> Form Page</a> &gt;&gt;
			<?php echo $catName;?>
		</div>
		
		<ul>
			<li class="header-row">
				<div class="title"><label>Post</label></div>
				<div class="last-post"><label>Information</label></div>
				<div class="threads"><label>&nbsp;</label></div>
				<div class="posts"><label>Posts</label></div>
				<div class="clearboth"></div>
			</li>
			<?php foreach(  $postlist['data'] as $cat):?>
			<li>
				<div class="title">
					<h2><a href="<?php echo $this->baseurl("/forum/p/{$cat['id']}/" . App::Helper('Utility')->text2normalize($cat['title'])) ?>"><?php echo($cat['title']);?></a></h2>
					<?php echo substr($cat['description'],0,200); ?>
					<p><a href="<?php echo $this->baseurl("/forum/p/{$cat['id']}/" . App::Helper('Utility')->text2normalize($cat['title'])) ?>">Read More...</a></p>
				</div>
				<div class="last-post">
					<br />
					<?php echo App::Helper('Forum')->Id2PostInfo($cat['id']); ?>
				</div>
				<div class="threads"><br /> <?php /*<a href="<?php echo $this->baseurl("/forum/p/{$cat['id']}/" . App::Helper('Utility')->text2normalize($cat['title'])) ?>#reply">Reply</a>*/ ?>&nbsp;</div>
				<div class="posts"><br /><?php echo App::Helper('Forum')->postId2CommentCount($cat['id']); ?></div>
				<div class="clearboth"></div>
			</li>
			<?php endforeach;?>
		</ul>
	</div>
<?php elseif($action == 'p'):?>	
	<div class="inner">
		
		<div class="forum-top-link">
			<?php $catName =  App::CategorySet()->categoryIdToName($postinfo['category']);?>
			<p>
				<a href="<?php echo $this->baseurl("/forum/"); ?>"> Forum Page</a> &gt;&gt;
				<a href="<?php echo $this->baseurl("/forum/c/{$postinfo['category']}/" . App::Helper('Utility')->text2Normalize($catName)); ?>"><?php echo $catName;?></a>
			</p>
		</div>
		<h2 id="post"><?php echo($postinfo['title']);?></h2>
		<ul class="forum-p">
			<li>
				<div class="post-user-info">
					<?php echo App::Helper('Forum')->Id2PostInfo($postinfo['id'],false); ?>
				</div>
				<div class="post-info">
					<?php echo stripslashes(App::Load("Helper/Utility")->codeFormated($postinfo['description'],false));?>
				</div>
			</li>
			<?php if(!empty($commetns['data'])):?>
					<?php foreach($commetns['data'] as $comment):?>
					   <li>
							<div class="post-user-info">
								<?php echo App::Helper('Forum')->Id2CommentInfo($comment['id'],false); ?>
							</div>
							<div class="post-info">
								<?php echo($comment['description']);?>
							</div>
					   </li>
					<?php endforeach;?>
			<?php endif;?>
		</ul>
		<?php if(App::MemberManager()->AppUserloggedInId()):?>
		<h2 id="reply"><?php echo $this->__('Post a replay'); ?></h2>
		<?php
			echo App::Load("Helper/Javascript")->validation_map(Array('_errBg'=>ERROR_BACKGROUND,'_dflBg'=>'#CFCFCF','_autoSubmit'=>'false','_errToolTips'=>'false','_errorMark' => 'inline'));
			echo App::Load("Helper/Javascript")->ajax_submit(array("form_name"=>".app_validation","debug"=>"false","auto_hide"=>"true","message_element"=>".message"));
		?>
		
		<div style="margin-left:5px">
		<div style="margin-left:5px" class="message"></div>
		<form method="post" class="app_form app_validation" action="<?php echo $this->baseurl("/forum/p/{$id}");?>">
			<input type="hidden" name="data[Comment][category]" value="<?php echo $postinfo['category']; ?>" />
			<ul>
				<li><label>Description</label><span>For Source code: &lt;pre class="brush:php">echo "Hello World";&lt;/pre> <textarea name="data[Comment][desc]" rows="10" class="input check_notempty"></textarea></span></li>
				<li><label><?php echo App::Helper('Html')->capachaTag("commentpost",Array("bk_color"=>"#99011E","font_color"=>"#FFFFFF"));?></label><span><input type="text" name="data[Comment][capacha]" class="input check_notempty" longdesc="Please fillin the text display left side image." value="" /></span></li>	
				<li><label>&nbsp;</label><span><input type="submit" name="data[Comment][submit]" value="Submit" /> <a class="anchor" href="#post">View Post</a></span></li>
			</ul>			
		</form>
		</div>
		<?php endif;?>
	</div>
<?php else: ?>
	<?php if(App::MemberManager()->AppUserloggedInId()):?>
	<div class="forum-top-link">
		<a href="<?php echo $this->baseurl("/add-post-to-forum");?>">New post </a>
	</div>
	<?php endif;?>
	
	<div class="forum-index">
		<ul>
			<li class="header-row">
				<div class="title"><label>Forum</label></div>
				<div class="last-post"><label>Last Thread</label></div>
				<div class="threads"><label>Thread</label></div>
				<div class="posts"><label>Posts</label></div>
				<div class="clearboth"></div>
			</li>
			<?php foreach(  $man_cat['data'] as $cat):?>
			<li>
				<div class="title">
					<h2><a href="<?php echo $this->baseurl("/forum/c/{$cat['id']}/" . App::Helper('Utility')->text2normalize($cat['title'])) ?>"><?php echo($cat['title']);?></a></h2>
					<?php echo($cat['description']); ?>
				</div>
				<div class="last-post"><br /><?php echo App::Helper('Forum')->Category2LastPostInfo($cat['id']); ?></div>
				<div class="threads"><br /><?php echo App::Helper('Forum')->Category2ThreadCount($cat['id']); ?></div>
				<div class="posts"><br /><?php echo App::Helper('Forum')->Category2PostCount($cat['id']); ?></div>
				<div class="clearboth"></div>
			</li>
			<?php endforeach;?>
		</ul>
	</div>
<?php endif;?>
<div class="clearboth"></div>
<?php  echo $this->runSyntaxHighlighter();?>